# flake8: NOQA

# 计算个人所得税(2022版)

z = float(input("请输入薪资累计收入:"))
a = float(input("请输入累计五险一金:"))
b = float(input("请输入累计专项附加扣除:"))
c = float(input("请输入累计减除费用:"))
d = float(input("请输入累计已交个税:"))


def my_tax(z, a, b, c):
    x = z-a-b-c
    if x <= 36000:
        t = x*0.03
    elif 36000 < x <= 144000:
        t = x*0.1-2520
    elif 144000 < x <= 300000:
        t = x*0.2-16920
    elif 300000 < x <= 420000:
        t = x*0.25-31920
    elif 420000 < x <= 660000:
        t = x*0.30-52920
    elif 660000 < x <= 960000:
        t = x*0.35-85920
    elif 960000 < x:
        t = x*0.45-181920
    return t


tt = my_tax(z, a, b, c)-d
print('累计应交个人所得税' + str(my_tax(z, a, b, c)))
print('累计已缴个人所得税' + str(d))
print('本期应交个人所得税' + str(tt))
